Litter and Trash Cans
logo

Clustering

searchable datatable

GRAPH ABOVE:

  • differences of mean distance for each cluster, by day

This graph represents the amount of litter collected per hour, for each collection object.

GRAPH ABOVE:

  • Shows amount of litter collected for each hour
colors <- colorNumeric(
  # function for color of collection types
  palette = c('#134a47', '#2859b8', 'green'),
  domain = c(1,2,3)
  )

labs <- lapply(seq(nrow(clusters)), function(i) {
  # function for mouseover of circles
  paste0( 'Collection Type: ', clusters[i, "cent_type"], '<p>Number of Litter Objects: ', 
          clusters[i, "num_litter"], '</p>Mean Distance: ', 
          round(clusters[i, "mean_dist"],2),' meters<p>Max Distance: ', 
          round(clusters[i, "max_dist"],2), ' meters</p>' ) 
})

html_legend <- "<img src='open-trash-can.png' style='width:20px;height:20px;'> Trash & Recycling<br/>

<img src='open-trash-can.png' style='width:20px;height:20px;'> Paper<br/>

<img src='cigarette.png' style='width:20px;height:20px;'> Tobacco<br/>

<img src='open-trash-can.png' style='width:20px;height:20px;'> Unknown<br/>

<img src='open-trash-can.png' style='width:20px;height:20px;'> Plastic<br/>

<img src='open-trash-can.png' style='width:20px;height:20px;'> Food<br/>

<img src='open-trash-can.png' style='width:20px;height:20px;'> Glass"

map <- clusters %>% 
  mutate(
    cent_type = ifelse(cent_type == 'trashCan', 1,
                       ifelse(cent_type == 'recyclingCan', 2, 3))
  ) %>% 
  leaflet(width = "100%") %>% 
  setView(lng = -122.2298, lat = 37.48650, zoom = 18) %>% 
  addProviderTiles(providers$CartoDB.Positron) %>% 
  addCircles(
    ~long, ~lat,
    radius = ~max_dist,
    color = ~colors(cent_type),
    opacity = ~num_litter/357,
    label = lapply(labs, HTML),
    group = "Collections"
  ) %>% 
  addMarkers(lng = ~long, lat = ~lat,
             icon = makeIcon("open-trash-can.png", "open-trash-can.png", 15,15),
             group = "Collections"
             ) %>% 
  addLayersControl(
    overlayGroups = c("Collections", litter),
    options = layersControlOptions(collapsed = FALSE)
  ) %>% 
  addControl(html = html_legend, position = "bottomleft")



for (i in 1:length(litter)){
  map <- map %>% 
    addMarkers(data = clustered_data %>% 
                 subset(rubbishType == litter[[i]]),
               lng = ~long, lat = ~lat,
               icon = makeIcon(icons[[i]], icons[[i]], 7,7),
               group = litter[[i]]
               ) 
}

map

ffffffffffffffffffffffffffffff

map looks disgusting

hexbin?

 




A work by Alexander Kahanek x Rubbish, co.